/**
 * 
 */
package guice.command;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id$
 */
public interface ICommand<D, R> {

	/**
	 * Specifies the {@link ICommandReceiver} that this {@link ICommand}
	 * instance can execute.
	 * 
	 * @param receiver
	 */
	public void setReceiver(ICommandReceiver<D, R> receiver);

	/**
	 * Sets the command request data required by this {@link ICommand}.
	 * 
	 * @param data
	 *            Command request data.
	 */
	public void setData(D data);

	/**
	 * Executes this {@link ICommand} instance to yield a result of type
	 * {@link R}.
	 * 
	 * @return
	 * @throws IllegalStateException
	 *             if an {@link ICommand} instance was not specified for this
	 *             {@link ICommandInvoker} instance.
	 */
	public R execute() throws IllegalStateException;
}
